﻿<Window x:Class="Explorer.MainWindow"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:Explorer="clr-namespace:Explorer"
		Title="Book Explorer - WPF Control Development Unleashed"
		Height="480"
		Width="640"
		WindowState="Maximized"
		Icon="Resources/book.png"
		Background="#0e0e0e">
	<Window.Resources>
		<Explorer:XmlToUriConverter x:Key="UriConverter" />
		<XmlDataProvider x:Key="BookMeta"
						 Source="BookMeta.xml"
						 XPath="/Book/Chapter" />

	</Window.Resources>
	<DockPanel Margin="8">
		<Border DockPanel.Dock="Left"
				Background="{StaticResource BlackGradient}"
				BorderBrush="{StaticResource RedGradient}"
				BorderThickness="1"
				Padding="5"
				SnapsToDevicePixels="True">
			<TreeView x:Name="_treeView"
					  ItemsSource="{Binding Source={StaticResource BookMeta}}"
					  ItemTemplate="{StaticResource ChapterTemplate}"
					  Template="{StaticResource TreeViewTemplate}"
					  MinWidth="300"
					  BorderThickness="0"
					  Background="Transparent"/>
		</Border>

		<DockPanel DataContext="{Binding SelectedItem, ElementName=_treeView}"
				   Margin="8,0,0,0">

			<!-- Example Title -->
			<Border DockPanel.Dock="Top"
					Padding="15"
					Background="{StaticResource RedGradient}">
				<TextBlock Text="{Binding XPath=@Title}"
						   FontSize="24"
						   TextAlignment="Center"
						   Foreground="GhostWhite" />
			</Border>

			<!-- Description -->
			<Border Background="DarkGray"
					DockPanel.Dock="Bottom">
				<TextBlock Text="{Binding XPath=Description}"
						   FontWeight="Bold"
						   Margin="10" 
						   TextWrapping="Wrap"
						   TextAlignment="Center"/>
			</Border>

			<!-- Example container -->
			<Frame Source="{Binding Converter={StaticResource UriConverter}}"
				   NavigationUIVisibility="Hidden"
				   Background="White"/>
		</DockPanel>
	</DockPanel>
</Window>
